<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="javascript">
	function printorder()
	{
		if(confirm("确认打印选中的订单，一旦打印将会自动标注打印标记?"))
		{
			var str = selectallpro();
			if(str !=false)
			{
				$("#orderlistst").val(str);
				$('#printform').modal('show');	
			}
		}
		
	}
	function printcodeorder()
	{
		var str = selectallpro();
		var winWidth = window.screen.width;
		var winHeight = window.screen.height;
		var newWidth = 900;
		var newHeight = 650;
		var url = "/factory/ajaxbutton?op=saveprintcode&type="+str;
		window.location.href=url;
		
		//window.open(url, '_blank', 'height=' + newHeight + ',width=' + newWidth + ',top=10,left=' + (winWidth - newWidth) / 2 + ',toolbar=no,menubar=no,scrollbars=yes,resizable=no,loocation=no,status=no');
	}
	/********增加多行上传附件*******************/
var totalnum = 1;
function showaddinput(t)
{
	var inputn = document.getElementById(t);
	var str=inputn.innerHTML;
	var num=1;
	for(var i=1;i<=num;i++){
		totalnum=totalnum+i;
		
		str += "<tr id=las"+totalnum+">";
		str +="<td><span id=status"+totalnum+"></span><a href=javascript:void(0) onclick=delfiledsinput("+totalnum+")>移</a></td><td><input name=\"orderid[]\" id=orderid"+totalnum+" placeholder=\"订单编号\" class=\"width80\" type=\"text\"></td><td><input name=\"scale[]\" placeholder=\"重量\" id=\"scale\" onClick=\"getpricepro("+totalnum+")\"  type=\"text\"  class=\"width100\"></td><td> <select name=\"person1[]\" id=\"caijian\" class=\"selection\" style=\"width:80px;\"><option value=\"0\" >裁剪人员</option>{{foreach from=$caijian item=li key=key}} <option value=\"{{$li.id}}\" {{if $detail.sell.person1 ==$li.id}} selected{{/if}}>{{$li.name}}</option> {{/foreach}} </select></td><td> <select name=\"zhijian[]\" id=\"zhijian\" class=\"selection\" style=\"width:80px;\"><option value=\"0\" >质检人员</option>{{foreach from=$zhijian item=li key=key}}<option value=\"{{$li.id}}\" {{if $detail.sell.proWorker ==$li.id}} selected{{/if}}>{{$li.name}}</option>{{/foreach}}</select></td><td> <select name=\"proWorker[]\" id=\"workers\" class=\"selection\" style=\"width:80px;\"><option value=\"0\" >生产工人</option>{{foreach from=$workers item=li key=key}}<option value=\"{{$li.id}}\" {{if $detail.sell.proWorker ==$li.id}} selected{{/if}}>{{$li.name}}</option>{{/foreach}}</select></td><td><input name=\"cosprice[]\" placeholder=\"成本\" id=\"cosprice"+totalnum+"\" type=\"text\"  class=\"width100\"><td><input name=\"wages[]\" placeholder=\"工价\" id=\"wages"+totalnum+"\" type=\"text\"  class=\"width100\"></td>";
		str+="</tr>";
		
		
		
		
	
	}
	$("#"+t).html(str);
	
}
function delfiledsinput(id)
{
	if(confirm("确定移除？"))
	{
		$("#las"+id).remove();
	}
}
function getprice(id,i)
{
	$("#errshow").html('');
	$("#errshowsku").html('');
	$.post("/factory/ajaxbutton", {"op": "getprice","orderid":id},
	  function(data){
		  if(data.wages=="err")
		  {
			 var wages = 0;
			 var cosprice = 0;
		  }else{
			var wages = data.wages;
			var cosprice = data.g_costprice;
			$("#errshowsku").html("<font colore=red>SKU: "+data.goods_sku+"</font>");
			
			if(data.isfactoryId)
			{
				$("#status"+id).html("<img src='/fuman/images/no.gif' title="+data.statustext+">");	
				$("#errshowsku").html("<font colore=red>错误: "+data.isfactoryId+"</font>");	
				 $("#orderid"+i).val('');
			}
		  }
	if(i ==100000)
	{
		if(data.status ==2)
		{
			$("#status"+id).html("<img src='/fuman/images/yes.gif' title="+data.statustext+">");	
		}else{
			$("#status"+id).html("<img src='/fuman/images/no.gif' title="+data.statustext+">");	
		}
		if(data.custom==3)
		{
			$("#errshow").html("<font colore=red>定制配件，请手工填写这个工价和成本价！</font>");
			
		}else{
			$("#wages"+id).val(wages);
			$("#cosprice"+id).val(cosprice);
		}
	}else{
		if(data.status ==2 &&　data.isfactoryId=='')
		{
			$("#status"+i).html("<img src='/fuman/images/yes.gif' title="+data.statustext+">");	
		}else{
			$("#status"+i).html("<img src='/fuman/images/no.gif' title="+data.statustext+">");	
		}
		if(data.custom==3)
		{
			$("#errshow").html("<font colore=red>定制配件，请手工填写这个工价和成本价</font>");
			
		}else{
			$("#wages"+i).val(wages);
			$("#cosprice"+i).val(cosprice);
		}
	}
	   },"json");
}
function AWSsubmitst(f,t)
{
	var tst= 0;
	var tsc= 0;
	var tscds = 0;
	
	var inputArray=$("input[id='scale']");//取到所有的input text 并且放到一个数组中 
	inputArray.each(//使用数组的循环函数 循环这个input数组  
         function (){  
             var input =$(this);//循环中的每一个input元素  
            if(input.val()=="")
			{
				 tst =1;
			}
         }  
     )
	 if(tst==1)
	 {
		alert("所有的重量必须填写完整!");
		return false;	
	 }
	 
	 var inputArrayst=$("input[name='wages[]']");//取到所有的input text 并且放到一个数组中 
		inputArrayst.each(//使用数组的循环函数 循环这个input数组  
			 function (){  
				 var input =$(this);//循环中的每一个input元素  
				if(input.val()=="")
				{
					 tsc =1;
				}
			 }  
		 )   
	
 	if(tsc==1)
	 {
		alert("所有的工价必须填写完整!");
		return false;	
	}
	
	 var inputArrayst=$("input[name='cosprice[]']");//取到所有的input text 并且放到一个数组中 
		inputArrayst.each(//使用数组的循环函数 循环这个input数组  
			 function (){  
				 var input =$(this);//循环中的每一个input元素  
				if(input.val()=="")
				{
					 tscds =1;
				}
			 }  
		 )   
	
 	if(tscds==1)
	 {
		alert("所有的成本价必须填写完整!");
		return false;	
	}
	
	
	
	$('#'+t).modal('hide');
	AWS.ajax_post($('#'+f));
	
	
}
function getpricepro(i)
{
	var id = $("#orderid"+i).val();
	getprice(id,i);
}

	function endorder()
	{
		var vote_arr = document.getElementsByName("ppid[]");
		var idarr = new Array();
		var i=0;
		var str="";
		var html="";
		for(var j = 0; j < vote_arr.length; j++)
		{
		   if(vote_arr[j].checked == true)
		   {
			   html+="<tr>";
			   idarr[i] = vote_arr[j].value;

			   var personworker = $("#"+idarr[i]).val();
			   var arr_person = personworker.split("-");
			   var person1 = arr_person[0];
			   var proWorker = arr_person[1];
			   var person1_flag = 0;
			   {{foreach from=$caijian item=li key=key}}
			       if({{$li.id}} == person1)
				   {
					   person1_flag = 1;
					   var person_name = '{{$li.name}}';
				   }
			   {{/foreach}}
			   var proWorker_flag = 0;
			   {{foreach from=$workers item=li key=key}}
				   if({{$li.id}} == proWorker)
				   {
					   proWorker_flag = 1;
					   var proWorker_name = '{{$li.name}}';
				   }
			   {{/foreach}}
			   if(person1_flag&&proWorker_flag){
				   html +="<td>&nbsp;&nbsp;&nbsp;<span id=status"+vote_arr[j].value+"></span></td><td><input name=\"orderid[]\" id=orderid"+vote_arr[j].value+" placeholder=\"订单编号\" class=\"width100\" type=\"text\" value="+vote_arr[j].value+"></td><td><input name=\"scale[]\" placeholder=\"重量\" onClick=\"getprice("+vote_arr[j].value+",100000)\" id=\"scale\" type=\"text\"  class=\"width100\"></td><td> <select name=\"person1[]\" id=\"caijian\" class=\"selection\" style=\"width:80px;\"><option value=\""+person1+"\">"+person_name+"</option></select></td><td> <select name=\"zhijian[]\" id=\"zhijian\" class=\"selection\" style=\"width:80px;\"><option value=\"0\" >质检人员</option>{{foreach from=$zhijian item=li key=key}}<option value=\"{{$li.id}}\" {{if $detail.sell.proWorker ==$li.id}} selected{{/if}}>{{$li.name}}</option>{{/foreach}}</select></td><td> <select name=\"proWorker[]\" id=\"workers\" class=\"selection\" style=\"width:80px;\"><option value=\""+proWorker+"\" >"+proWorker_name+"</option></select></td><td><input name=\"cosprice[]\" placeholder=\"成本价\" id=\"cosprice"+vote_arr[j].value+"\" type=\"text\"  class=\"width100\"></td><td><input name=\"wages[]\" placeholder=\"工价\" id=\"wages"+vote_arr[j].value+"\" type=\"text\"  class=\"width100\"></td>";
			   }else if(person1_flag){
				   html +="<td>&nbsp;&nbsp;&nbsp;<span id=status"+vote_arr[j].value+"></span></td><td><input name=\"orderid[]\" id=orderid"+vote_arr[j].value+" placeholder=\"订单编号\" class=\"width100\" type=\"text\" value="+vote_arr[j].value+"></td><td><input name=\"scale[]\" placeholder=\"重量\" onClick=\"getprice("+vote_arr[j].value+",100000)\" id=\"scale\" type=\"text\"  class=\"width100\"></td><td> <select name=\"person1[]\" id=\"caijian\" class=\"selection\" style=\"width:80px;\"><option value=\""+person1+"\">"+person_name+"</option></select></td><td> <select name=\"zhijian[]\" id=\"zhijian\" class=\"selection\" style=\"width:80px;\"><option value=\"0\" >质检人员</option>{{foreach from=$zhijian item=li key=key}}<option value=\"{{$li.id}}\" {{if $detail.sell.proWorker ==$li.id}} selected{{/if}}>{{$li.name}}</option>{{/foreach}}</select></td><td> <select name=\"proWorker[]\" id=\"workers\" class=\"selection\" style=\"width:80px;\"><option value=\"0\" >生产工人</option>{{foreach from=$workers item=li key=key}}<option value=\"{{$li.id}}\" {{if $detail.sell.proWorker ==$li.id}} selected{{/if}}>{{$li.name}}</option>{{/foreach}}</select></td><td><input name=\"cosprice[]\" placeholder=\"成本价\" id=\"cosprice"+vote_arr[j].value+"\" type=\"text\"  class=\"width100\"></td><td><input name=\"wages[]\" placeholder=\"工价\" id=\"wages"+vote_arr[j].value+"\" type=\"text\"  class=\"width100\"></td>";
			   }else if(proWorker_flag){
				   html +="<td>&nbsp;&nbsp;&nbsp;<span id=status"+vote_arr[j].value+"></span></td><td><input name=\"orderid[]\" id=orderid"+vote_arr[j].value+" placeholder=\"订单编号\" class=\"width100\" type=\"text\" value="+vote_arr[j].value+"></td><td><input name=\"scale[]\" placeholder=\"重量\" onClick=\"getprice("+vote_arr[j].value+",100000)\" id=\"scale\" type=\"text\"  class=\"width100\"></td><td> <select name=\"person1[]\" id=\"caijian\" class=\"selection\" style=\"width:80px;\"><option value=\"0\" >裁剪人员</option>{{foreach from=$caijian item=li key=key}} <option value=\"{{$li.id}}\" {{if $detail.sell.person1 ==$li.id}} selected{{/if}}>{{$li.name}}</option> {{/foreach}} </select></td><td> <select name=\"zhijian[]\" id=\"zhijian\" class=\"selection\" style=\"width:80px;\"><option value=\"0\" >质检人员</option>{{foreach from=$zhijian item=li key=key}}<option value=\"{{$li.id}}\" {{if $detail.sell.proWorker ==$li.id}} selected{{/if}}>{{$li.name}}</option>{{/foreach}}</select></td><td> <select name=\"proWorker[]\" id=\"workers\" class=\"selection\" style=\"width:80px;\"><option value=\""+proWorker+"\">"+proWorker_name+"</option></select></td><td><input name=\"cosprice[]\" placeholder=\"成本价\" id=\"cosprice"+vote_arr[j].value+"\" type=\"text\"  class=\"width100\"></td><td><input name=\"wages[]\" placeholder=\"工价\" id=\"wages"+vote_arr[j].value+"\" type=\"text\"  class=\"width100\"></td>";
			   }else{
				   html +="<td>&nbsp;&nbsp;&nbsp;<span id=status"+vote_arr[j].value+"></span></td><td><input name=\"orderid[]\" id=orderid"+vote_arr[j].value+" placeholder=\"订单编号\" class=\"width100\" type=\"text\" value="+vote_arr[j].value+"></td><td><input name=\"scale[]\" placeholder=\"重量\" onClick=\"getprice("+vote_arr[j].value+",100000)\" id=\"scale\" type=\"text\"  class=\"width100\"></td><td> <select name=\"person1[]\" id=\"caijian\" class=\"selection\" style=\"width:80px;\"><option value=\"0\" >裁剪人员</option>{{foreach from=$caijian item=li key=key}} <option value=\"{{$li.id}}\" {{if $detail.sell.person1 ==$li.id}} selected{{/if}}>{{$li.name}}</option> {{/foreach}} </select></td><td> <select name=\"zhijian[]\" id=\"zhijian\" class=\"selection\" style=\"width:80px;\"><option value=\"0\" >质检人员</option>{{foreach from=$zhijian item=li key=key}}<option value=\"{{$li.id}}\" {{if $detail.sell.proWorker ==$li.id}} selected{{/if}}>{{$li.name}}</option>{{/foreach}}</select></td><td> <select name=\"proWorker[]\" id=\"workers\" class=\"selection\" style=\"width:80px;\"><option value=\"0\" >生产工人</option>{{foreach from=$workers item=li key=key}}<option value=\"{{$li.id}}\" {{if $detail.sell.proWorker ==$li.id}} selected{{/if}}>{{$li.name}}</option>{{/foreach}}</select></td><td><input name=\"cosprice[]\" placeholder=\"成本价\" id=\"cosprice"+vote_arr[j].value+"\" type=\"text\"  class=\"width100\"></td><td><input name=\"wages[]\" placeholder=\"工价\" id=\"wages"+vote_arr[j].value+"\" type=\"text\"  class=\"width100\"></td>";
			   }

			   html+="</tr>";

			   i++;
		   }

		}
		if(i<=0){
			$('#endorderform').modal('show');	
		}else{
			$("#endorderlistst").html(html);
			$('#endorderform').modal('show');	
			
		}
		
		
		
		
	}
	
	function onstsubmit()
	{
		$('#printform').modal('hide');	
		$('#attributeform').submit();
	}
	function showmabangorder()
	{
		$('#showmabangorder').modal('show');	
	}
	function makeinvalid()
	{
		$('#smakeinvalid').modal('show');	
	}
	function exportorder()
	{
		$("#exportorder").modal('show');	
	}
	function urgentorder()
	{
		$("#urgentorder").modal('show');	
	}
	function atsmakeinvalid()
	{
		  $("#invalidform").submit();	
	}
	function atmangban()
	{
		var orderid = $("#getorderlist").val();
		if(orderid == '')
		{
			alert("请输入工厂订单号！")
			return;	
		}
		var Dhldeliver = $("#type").val();
		if(Dhldeliver == '')
		{
			alert("请选择交运方式！")
			return;	
		}
		var orderType=3;
		if(Dhldeliver!='DHL'){
			if(Dhldeliver=="UPS"){
				orderType=2;
			}else{
				orderType=1;
			}
			$("#shipmentform").attr("action", "/order/ajaxbutton?op=saveexpress");
			
		}else{
			$("#shipmentform").attr("action", "/expressshipment/ajaxbutton?op=DHLexpress");
		}
		$.post("/factory/ajaxbutton", {"op": "getorderForFactoryNumber","id":orderType,"orderlist":orderid,"type":Dhldeliver},
		  function(data){
			  $("#orderlist").val(data);
			  $("#orderType").val(orderType);
			  $("#shipmentform").submit();
		},"text");
		
	}
	function atsavemangban()
	{
		
	   var orderid = $("#getmborderlist").val();
	   if(orderid=="")
	   {
		 alert("订单号为空!");
		 return;  
		 }
		 var cf = $("#cf").val();
	   if(cf=="0")
	   {
		 alert("请选择订单来源!");
		 return;  
		 }
	   var winWidth = window.screen.width;
	   var winHeight = window.screen.height;
	   var newWidth = 900;
	   var newHeight = 650;
	   if(cf==2)
	   {
		    var url = "/doit/ajaxbutton?op=AutoinsertordertofactoryPro&orderid="+orderid+"&cf="+cf;
		   }else{
	   var url = "/doit/ajaxbutton?op=Autoinsertordertofactory&orderid="+orderid+"&cf="+cf;
		   }
	   window.open (url,'_blank','height='+newHeight+',width='+newWidth+',top=10,left='+(winWidth-newWidth)/2+',toolbar=no,menubar=no,scrollbars=yes,resizable=no,loocation=no,status=no');
	$("#exportorder").modal('hide');	

		
		
			
	}
	function saveurgentorder()
	{
		var memo = $("#urgentordermemo").val();
		if(memo=='')
		{
			alert("请选择优先处理理由！");
			return;	
		}
		var str = selectallpro();
		if(str !=false)
		{
			if(confirm("确认将选中的订单，修改状态?"))
			{
				$.post("/factory/ajaxbutton", {"op": "saveurgentorder","id":str,"memo":memo},
			  function(data){
				  	if(data.code==200)
					{
						window.location.href = "/factory/orderlist?other="+data.txt;
					}
					if(data.code==201)
					{
						alert(data.txt);
						return;
					}
					
			   },"json");	
			}
				
		}
	}
	function changstatusPro(t)
	{
		var str = selectallpro();
		
		if(str !=false)
		{
			if(confirm("确认将选中的订单，修改状态?"))
			{
				
			$.post("/factory/ajaxbutton", {"op": "changstatus","id":str,"st":t},
			  function(data){
				  	if(data.code==201)
					{
						
						var winWidth = window.screen.width;
						var winHeight = window.screen.height;
						var newWidth = 900;
						var newHeight = 650;
						var url = "/factory/ajaxbutton?op=printcontent&txt="+data.txt;
						window.open (url,'_blank','height='+newHeight+',width='+newWidth+',top=10,left='+(winWidth-newWidth)/2+',toolbar=no,menubar=no,scrollbars=yes,resizable=no,loocation=no,status=no');
						if(data.url)
						{
							window.location.href = "/factory/orderlist?other="+data.url;
						}
						//window.location.href = "/factory/ajaxbutton?op=printcontent&txt="+data.txt;
					}else{
						window.location.href = "/factory/orderlist?other="+data.txt;
					}
						
					
			   },"json");
			}
		}
	}
	function searchl(orderby)
	{
		$("#orderby").val(orderby);
		$("#search").submit();
	}
	function ouputcsv()
	{
		var str = selectallpro();
		if(str !=false)
		{
			$("#if_csv").val(1);
			$("#csvlist").val(str);
			$("#search").attr("target","_thank");
			$("#search").submit();
		}
		
	}
</script>
<title>工厂订单列表</title>
<body class="withvernav">
<div class="bodywrapper">
{{include file='/public/leftmenu.tpl'}}
<div class="centercontent">
<div class="pageheader notab">
  <h1 class="pagetitle">工厂订单列表</h1>
  <span class="pagedesc"></span>
  <div class="menulist">
    <ul class="profile_summary">
       <li {{if $status==""}} class="current"{{/if}}> <a href="/factory/orderlist"><span>所有订单</span></a></li>
       <li {{if $status==1}} class="current"{{/if}}> <a href="/factory/orderlist?st=1"><span>新订单</span></a></li>
       <li {{if $status==2}} class="current"{{/if}}> <a href="/factory/orderlist?st=2"><span>生产中</span></a></li>
       <li {{if $status==3}} class="current"{{/if}}> <a href="/factory/orderlist?st=3"><span>生产完成</span></a></li>
       <li {{if $status==4}} class="current"{{/if}}> <a href="/factory/orderlist?st=4"><span>已发货</span></a></li>
       <li {{if $status==9}} class="current"{{/if}}> <a href="/factory/orderlist?st=9"><span>优先列表</span></a></li>
       
        </ul>
  </div>
  
</div>
<!--pageheader-->
<div id="contentwrapper" class="contentwrapper">
<div id="basicform" class="subcontent">
   <!--搜索栏-->
          <div>
          
   		<div style="float:left">
        {{if $managers ||  $userdepartment==4}}  <a href="javascript:void(0)" onClick="changstatusPro(2)" class="stdbtn btn_red"><span>标生产</span></a>{{/if}}
       
        {{if $managers || in_array('105',$showpower)}}  <a href="javascript:void(0)" onClick="changstatusPro(7)" class="stdbtn btn_red"><span>标加急</span></a>{{/if}}
         {{if $managers || in_array('105',$showpower)}}  <a href="javascript:void(0)" onClick="changstatusPro(16)" class="stdbtn btn_red"><span>取消加急</span></a>{{/if}}
         {{if $managers || in_array('105',$showpower)}}  <a href="javascript:void(0)" onClick="changstatusPro(6)" class="stdbtn btn_red"><span>禁止发货</span></a>{{/if}}
          {{if $managers || in_array('105',$showpower)}}  <a href="javascript:void(0)" onClick="changstatusPro(16)" class="stdbtn btn_red"><span>取消禁止发货</span></a>{{/if}}
         <!-- {{if $managers ||  $userdepartment==4}}  <a href="javascript:void(0)" onClick="changstatusPro(3)" class="stdbtn btn_red"><span>标完成</span></a>{{/if}}-->
          {{if $managers ||  $userdepartment==4}}  <a href="javascript:void(0)" onClick="changstatusPro(4)" class="stdbtn btn_red"><span>标发货</span></a>{{/if}}
          
          {{if $managers ||  $userdepartment==4 ||  in_array('105',$showpower)}} 
          	{{if $isinvalid==2}}
            	<a href="javascript:void(0)" onClick="changstatusPro(5)" class="stdbtn btn_red"><span>确认作废</span></a>
            {{else}}
            		
                  {{if $userclassid == 12 || $userclassid == 13}}
                  		<button onClick="makeinvalid()"  class="stdbtn btn_black">请求作废</button>
                  {{else}}
                  		<a href="javascript:void(0)" onClick="changstatusPro(5)" class="stdbtn btn_red"><span>标作废</span></a>
                  {{/if}}
            	
            	
            {{/if}}
           
           
          
          {{/if}}
          
           
           {{if $managers || in_array('104',$showpower)}}  <button onClick="printorder()"  class="stdbtn btn_black">打印</button>{{/if}}
           
           {{if $managers || in_array('104',$showpower)}}  <button onClick="endorder()"  class="stdbtn btn_black">批量完成</button>{{/if}}
            <button onClick="ouputcsv()"  class="stdbtn btn_black">订单导出</button>
           
        {{if $managers ||  $userclassid==10}}  <a href="javascript:void(0)" onClick="showmabangorder()" class="stdbtn btn_red"><span id="tip_info">工厂的订单交运DHL、UPS</span>看件交运</a>{{/if}}
        
         {{if $managers || in_array('105',$showpower)}}  <a href="javascript:void(0)" onClick="exportorder()" class="stdbtn btn_red"><span>手动派单</span></a>{{/if}}
         {{if $managers || in_array('104',$showpower)}}  <button onClick="printcodeorder()"  class="stdbtn btn_black">打印订单条码</button>{{/if}}
         
          {{if $managers || $userdepartment==3}}
        <!-- <a href="javascript:void(0)" onClick="urgentorder()" class="stdbtn btn_red"><span>申请优先处理</span></a>-->
          {{/if}}
		
		    {{if $managers || in_array('105',$showpower)}}
		         <button onClick="produce_status(1)"  class="stdbtn btn_black">批量标生产状态</button>
		    {{/if}}
         </div>
         <div style="clear: both"></div>
         <div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
   </div>
      
    <form class="stdform stdform2" method="get" id="search" action="/factory/orderlist">
    <input type='hidden' name='if_csv' id='if_csv'>
    <input type='hidden' name='csvlist' id='csvlist'>
    <input type='hidden' name='orderby' id='orderby'>

      <div class="tableoptions"> 
        <select name="shopname" id="shopname"  class="selection select2_group" style="width:150px;" >
        <option value="" >店铺</option>
        {{foreach from=$d_shop item=li key=key}}
              <option value="{{$li.name}}" {{if $shopname==$li.name}} selected{{/if}}>{{$li.name}}</option>
        {{/foreach}}
        </select>
        <select name="fID" id="fID"  class="selection " style="width:100px;" >
        <option value="" >工厂</option>
        {{foreach from=$factorylist item=li key=key}}
			<option value="{{$li.id}}" {{if $li.id==$fID}} selected{{/if}}>{{$li.name}}</option>
        {{/foreach}}
        </select>
          <select name="st" id="searchtype" class="selection " style="width:100px;" >
          <option value="" >订单状态</option>
        <option value="1" {{if $status==1}} selected{{/if}}>新订单</option>
        <option value="2" {{if $status==2}} selected{{/if}}>生产中</option>
        <option value="3" {{if $status==3}} selected{{/if}}>生产完成</option>
        <option value="4" {{if $status==4}} selected{{/if}}>已发货</option>
        <option value="5" {{if $status==5}} selected{{/if}}>作废单</option>
        <option value="6" {{if $status==6}} selected{{/if}}>禁止发货</option>
        <option value="7" {{if $status==7}} selected{{/if}}>加急单</option>
        <option value="8" {{if $status==8}} selected{{/if}}>未派单</option>
        <option value="9" {{if $status==9}} selected{{/if}}>优先处理</option>
        
      </select>        
               
       <select name="ty" id="searchtype" class="selection" style="width:100px;" >
        <option value="1" {{if $ty==1}} selected{{/if}}>订单时间</option>
        <option value="2" {{if $ty==2}} selected{{/if}}>交货时间</option>
        <option value="3" {{if $ty==3}} selected{{/if}}>发货时间</option>
        <option value="4" {{if $ty==4}} selected{{/if}}>完成时间</option>
      </select>
    
       <input type="text"  name="starttime" value="{{$starttime}} " onClick="WdatePicker({dateFmt:'yyyy-MM-dd '})" class="width100 hasDatepicker" /> - <input type="text"  name="endtime" value="{{$endtime}} " onClick="WdatePicker({dateFmt:'yyyy-MM-dd '})" class="width100 hasDatepicker" />
       订单号: <input type="text" name="other" id="other" class="width200" value="{{$other}}" placeholder="订单编号" />
       交易号： <input type="text" name="tradeid" id="tradeid" class="width100" value="{{$tradeid}}" placeholder="交易号" />
       SKU: <input type="text" name="kw" id="kw" class="width100" value="{{$goodsku}}" placeholder="商品编号" />
       &nbsp;
      生产工人:
                          <select class="selectCss2" name="wk" id="wk">
                    <option value="">请选择</option>
                    {{foreach from=$workers item=res key=key}}
                    <option value="{{$res.id}}" {{if $wk==$res.id}} selected{{/if}}> {{$res.name}} </option>
                    {{/foreach}}
                  </select>
          &nbsp;
      裁剪人员:
                          <select class="selectCss2" name="cj" id="cj">
                    <option value="">请选择</option>
                    {{foreach from=$caijian item=res key=key}}
                    <option value="{{$res.id}}" {{if $cj==$res.id}} selected{{/if}}> {{$res.name}} </option>
                    {{/foreach}}
                  </select>
	      生产中状态:
	      <select class="selectCss2" name="produce_status" id="produce_status">
		      <option value="">请选择</option>
		      <option value="1" {{if $produce_status==1}} selected{{/if}}>裁剪中</option>
		      <option value="2" {{if $produce_status==2}} selected{{/if}}>裁剪完成</option>
		      <option value="3" {{if $produce_status==3}} selected{{/if}}>制作中</option>
		      <option value="4" {{if $produce_status==4}} selected{{/if}}>制作完成</option>
	      </select>
                           
&nbsp;
		  买家账号: <input type="text" name="customerId" id="other" class="width100" value="{{$customerId}}" placeholder="买家账号" />
       &nbsp;
	      申请作废状态:
	      <select class="selectCss2" name="cancel_flag" id="cancel_flag">
		      <option value="">请选择</option>
		      <option value="1" {{if $cancel_flag==1}} selected{{/if}}>申请中</option>
	      </select>
        <button class="btn btn-primary" id="searchbtn">Search</button>
     &nbsp;
      </div>
      
    
    </form>
    <!--搜索栏结束-->
    <div class="x_content" style="overflow-x:auto;">
<table cellpadding="0" cellspacing="0" border="0" class="stdtable" >
<thead>
  <tr class="lbbt">
    <td width="5%" bgcolor="#FEFFF1"><a onClick="allSelect('ppid[]')">全选</a></td>
    <td width="10%" bgcolor="#FEFFF1">订单编号</td>
    <td width="8%" bgcolor="#FEFFF1">状态</td>
	  <!--
	  <td width="6%" bgcolor="#FEFFF1">生产状态</td>
	  -->
    <td width="18%" bgcolor="#FEFFF1">商品名称</td>
    <td width="12%" bgcolor="#FEFFF1">交易号</td>
    <td width="15%" bgcolor="#FEFFF1">平台/店铺/负责人</td>
    <td width="5%" bgcolor="#FEFFF1">生产工厂</td>
    <td width="8%" bgcolor="#FEFFF1" ><a href="javascript:void(0)" onClick="searchl({{$orderbyst}})">订单</a>/交货日期</td>
    <td width="9%" bgcolor="#FEFFF1">完成/发货时间</td>
    <td width="14%"bgcolor="#FEFFF1" >客户ID/国家</td>

    
  </tr>
</thead>
<tbody >

{{foreach from=$orderlist item=li key=key}}
  <tr>
    <td><input name="ppid[]" type="checkbox" class="none" id="ppid[]" value="{{$li.orderId}}" />{{if $li.printflag==1}}<img src="/fuman/images/print.png" title="已打印">{{/if}}{{if $li.descr}}<a ><img src="/fuman/images/bj.jpg" title="备注信息"><span id="tip_info">{{$li.descr}}</span></a>{{/if}}</td>
    <td valign="middle" bgcolor="#FFFFFF" style="position:relative;">
	 <input type="hidden" id="{{$li.orderId}}" value="{{$li.person1}}-{{$li.proWorker}}" />
     <a href="/factory/orderdetail?id={{$li.id}}"><font color="#6666FF">{{$li.orderId}}</font></a>
     </td>
    <td valign="middle" bgcolor="#FFFFFF">
	    {{if $li.updateflag==9}}{{$li.statustext}}{{else}}<font color=red>{{$li.statustext}}</font>{{/if}}{{if $li.orderurgent=='-4'}}<br><font color="#FF0000">禁止发货</font>{{/if}}{{if $li.orderurgent=='-5'}}<br><font color="#FF0000">加急</font>{{/if}}

   {{if $li.orderurgent=='17'}}<br><font color="#FF0000">待审核</font>{{/if}}
    {{if $li.orderurgent==18 && $li.orderurgenttip==1 && ($li.status==2 or $li.status==1)}}<br><font color="#FF0000">优先处理</font>{{/if}}
    {{if $li.cancel_flag ==1}}
	    <br/><span style="color:red;">销售申请作废</span>
	    {{/if}}
    </td>
    <td height="58" bgcolor="#FFFFFF" style="position:relative;">
    <div style=" float:left; border:1px solid #CCC; margin-right:10px;">
    	{{if $li.local_url}}<a href="/{{$li.local_url}}" target="_blank"> <img src="{{$li.thumb_url}}" height="50"></a>{{else}} <img src="{{$li.thumb_url}}" height="50">{{/if}}</div>
      <div style="margin-left:10px;">  {{$li.skuName}}<br>
     	<a href="/factory/orderdetail?id={{$li.id}}"><font color="#6666FF">{{$li.goods_sku}}</font></a>
       <!--<br>{{$li.mabangorderid}}-->
    </div>
     
      <div class="lbcp">
      </div>
   </td>
    <td valign="middle" bgcolor="#FFFFFF">{{$li.dealid}}</td>
    <td valign="middle" bgcolor="#FFFFFF">{{$li.shopId}}<br>{{$li.platformId}}<br>{{$li.responsible}}</td>
    <td bgcolor="#FFFFFF" class="cz">{{$li.factoryl}}<br/>
	    {{if $li.produce_status eq 1}}
	    裁剪中
	    {{/if}}
	    {{if $li.produce_status eq 2}}
	    裁剪完成
	    {{/if}}
	    {{if $li.produce_status eq 3}}
	    制作中
	    {{/if}}
	    {{if $li.produce_status eq 4}}
	    制作完成
	    {{/if}}
    </td>
    <td bgcolor="#FFFFFF" class="cz">{{$li.orderTime}}<br>{{$li.deliveryTime}}</td>
    <td bgcolor="#FFFFFF" class="cz">
    {{$li.finshtime}}<br>{{$li.shopmenttime}}
   </td>
    <td bgcolor="#FFFFFF" class="cz">{{$li.customerId}}<br>{{$li.country}}&nbsp;&nbsp;
     {{if $managers || $userdepartment==3}}
     	{{if $li.isform==0}}
    <a href="http://192.168.1.88:90/eshop/order.do?method=edit&orderid={{$li.mabangorderid}}" target="_blank"><img src="/fuman/images/icons/attachment.png"><span id="tip_info">马帮订单</span></a>
    	{{else}}
        <a href="/orderlist/editorder?sn={{$li.mabangorderid}}" target="_blank"><img src="/fuman/images/icons/attachment.png"><span id="tip_info">订单详细</span></a>
        {{/if}}
    {{/if}}
    </td>
   
  </tr>
   
{{/foreach}}
</tbody>

</table>
</div>
  <div class="page">{{$pageList}} 计{{$total}}条记录，共{{$totalpage}}页</div>
</div>
</div>
<!-- 模态框（Modal）打印内容 -->
<form action="/factory/ajaxbutton?op=printorder"  method="post" name="attributeform" id="attributeform" target="_blank">
  <div class="modal fade" id="printform" tabindex="-1" role="dialog" aria-labelledby="sprintform" aria-hidden="true">
    <div class="modal-dialog" style="width:740px;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" 
               aria-hidden="true">× </button>
          <h4 class="modal-title" id="sprintform"> 待处理订单编号  </h4>
        </div>
        <div class="modal-body">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="100">订单号： </td>
              <td align="left"><textarea name="orderlist" id="orderlistst" cols="10" rows="10"></textarea></td>
            </tr>
          
             <tr>
              <td>取消打印标记： </td>
              <td align="left"><input name="isclenr" type="checkbox" value="1"></td>
            </tr>
          </table>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" 
               data-dismiss="modal"> 关闭 </button>
            <button type="button" class="btn btn-primary"  onclick="onstsubmit()"> 提交 </button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
 </form>
  <!-- /.modal -->


<!-- 模态框（Modal）批量标完成 -->
<form action="/factory/ajaxbutton?op=batchendorder"  method="post" name="batchendorderST" id="batchendorderST">
  <div class="modal fade" id="endorderform" tabindex="-1" role="dialog" aria-labelledby="sendorderform" aria-hidden="true">
    <div class="modal-dialog" style="width:740px;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" 
               aria-hidden="true">× </button>
          <h4 class="modal-title" id="sendorderform"> 待处理订单编号  </h4>
        </div>
        <div class="modal-body">
         <a href="javascript:void(0)"  onClick="showaddinput('fileinput')" class="btn btn_book"><span>添加一行</span></a><span id="errshow"></span>
          <span id="errshowsku"></span>
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
          
          <div style="width:100%;height:400px; overflow-y:scroll; border:0px solid;">
           <span id="endorderlistst">
           </span>
           <span id="fileinput"></span>
          </div>
          </table>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" 
               data-dismiss="modal"> 关闭 </button>
            <button type="button" class="btn btn-primary"  onclick="AWSsubmitst('batchendorderST','endorderform')"> 提交 </button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
  <!-- /.modal -->
  </form>
	<!-- 模态框（Modal）生产中 分 裁剪中 裁剪完成 制作中 制作完成 -->
	<form action="/factory/ajaxbutton?op=producestatusorder"  method="post" name="batchproduceorderST" id="batchproduceorderST">
		<div class="modal fade" id="producestatusorderform" tabindex="-1" role="dialog" aria-labelledby="sendorderform" aria-hidden="true">
			<div class="modal-dialog" style="width:740px;">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"
						        aria-hidden="true">× </button>
						<h4 class="modal-title" id="sendorderform">  批量标生产状态  </h4>
					</div>
					<div class="modal-body">
						<table width="100%" border="0" cellspacing="0" cellpadding="0">

							<div>
           <span id="producestatusorderlistst">
	           	           <tr>
		                       <td>
			                       选择状态：
			                       <select name="producestatus" id="producestatus" class="selection" style="width:120px;" onChange="produce_status(2)">
				                       <option value="0" >请选择</option>
				                       <option value="1">裁剪中</option>
				                       <option value="2">裁剪完成</option>
				                       <option value="3">制作中</option>
				                       <option value="4">制作完成</option>
			                       </select>
		                       </td>
	                       </tr>
	           <tr style="display: none;" id="caijianid">
	           <td>
		           裁剪人员：
		           <select name="pcaijian" id="pcaijian" class="selection" style="width:120px;">
			           <option value="0" >请选择</option>
			           {{foreach from=$caijian item=li key=key}}
			           <option value="{{$li.id}}">{{$li.name}}</option>
			           {{/foreach}}
		           </select>
	           </td>
	           </tr>
	           <tr style="display: none;" id="workersid">
	           <td>
		           生产工人：
		           <select name="pworkers" id="pworkers" class="selection" style="width:120px;">
			           <option value="0" >请选择</option>
			           {{foreach from=$workers item=li key=key}}
			           <option value="{{$li.id}}">
				           {{$li.name}}
			           </option>
			           {{/foreach}}
		           </select>
	           </td>
	           </tr>
	           	           <tr>
		                       <td>
			                       时&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;间：
			                       <input type="text" name="cur_date" id="cur_date" value="" style="width:120px;" onClick="WdatePicker({dateFmt:'yyyy-MM-dd '})" class="width100 hasDatepicker">
		                       </td>
	                       </tr>
           </span>
							</div>
						</table>
						<div class="modal-footer">
							<button type="button" class="btn btn-default"
							        data-dismiss="modal"> 关闭 </button>
							<button type="button" class="btn btn-primary"  onclick="produce_status(3)"> 提交 </button>
						</div>
					</div>
					<!-- /.modal-content -->
				</div>
				<!-- /.modal-dialog -->
			</div>
		</div>
		<!-- /.modal -->
	</form>
  
  <!-- 模态框（Modal）显示马帮订单号 -->
  <form  method="post" id="shipmentform" name="shipmentform" action="/expressshipment/ajaxbutton?op=DHLexpress" target="_blank">
  <div class="modal fade" id="showmabangorder" tabindex="-1" role="dialog" aria-labelledby="sshowmabangorder" aria-hidden="true">
    <div class="modal-dialog" style="width:740px;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" 
               aria-hidden="true">× </button>
          <h4 class="modal-title" id="sshowmabangorder"> 输入订单编号  </h4>
        </div>
        <div class="modal-body">
         <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="100">工厂订单号： </td>
              <td align="left"><textarea name="getorderlist" id="getorderlist" cols="10" rows="10"></textarea>一行一个</td>
            </tr>
            <tr>
              <td>交运方式： </td>
              <td align="left">
              	  <input type="hidden" name="orderlist" id="orderlist" >
                  <input type="hidden" name="orderType" id="orderType" >
                  <select name="type" id="type">
                  <option value="">请选择交运方式</option>
                  <option value="DHL">DHL</option>
                  <option value="UPS">UPS</option>
                  <option value="sfexpress">顺丰</option>
                </select>
              </td>
            </tr>
          <tbody id="showmabangid"></tbody>
          </table>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" 
               data-dismiss="modal"> 关闭 </button>
            <button type="button" class="btn btn-primary"  onclick="atmangban()"> 提交 </button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
  <!-- /.modal -->
  </form>
  
  
   <!-- 模态框（Modal） -->
  <form  method="get" id="invalidform" name="invalidform" action="/factory/orderlist" target="_blank">
  <input type="hidden" name="st" id="st" value="2">
  <input type="hidden" name="isinvalid" id="isinvalid" value="2">
  <div class="modal fade" id="smakeinvalid" tabindex="-1" role="dialog" aria-labelledby="ssmakeinvalid" aria-hidden="true">
    <div class="modal-dialog" style="width:540px;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" 
               aria-hidden="true">× </button>
          <h4 class="modal-title" id="ssmakeinvalid"> 作废  </h4>
        </div>
        <div class="modal-body">
         <table width="100%" border="0" cellspacing="0" cellpadding="0">
           
            <tr>
              <td>请输入SKU： </td>
              <td align="left"><input type="text" name="kw" id="kw"></td>
            </tr>
            
            <tr>
            <td>尺码</td>
            <td>
                版型：<select class="full_input" id="model" name="model">
                  <option value="0" selected>-版型-</option>
                  <option value="1" {{if $detail.sell.model==1}} selected{{/if}}>欧美</option>
                  <option value="2" {{if $detail.sell.model==2}} selected{{/if}}>亚洲</option>
                </select>
<br><br>
性别：<select class="full_input" id="gender1" name="gender1" >
                  <option value="0" selected>-性别-</option>
                  <option value="1" {{if $detail.sell.gender1==1}} selected{{/if}}>-男-</option>
                  <option value="2" {{if $detail.sell.gender1==2}} selected{{/if}}>-女-</option>
                   <option value="3" {{if $detail.sell.gender1==3}} selected{{/if}}>-通用-</option>
                </select>
<br><br>
尺寸：<select class="full_input" name="size" id="size" >
                  <option value="0" selected>-尺寸-</option>
                  <option value="25" {{if $detail.sell.size==25}} selected{{/if}}>-XXS-</option>
                  <option value="30" {{if $detail.sell.size==30}} selected{{/if}}>-XS-</option>
                  <option value="35" {{if $detail.sell.size==35}} selected{{/if}}>-S-</option>
                  <option value="40" {{if $detail.sell.size==40}} selected{{/if}}>-M-</option>
                  <option value="45" {{if $detail.sell.size==45}} selected{{/if}}>-L-</option>
                  <option value="50" {{if $detail.sell.size==50}} selected{{/if}}>-XL-</option>
                  <option value="55" {{if $detail.sell.size==55}} selected{{/if}}>-XXL-</option>
                  <option value="60" {{if $detail.sell.size==60}} selected{{/if}}>-XXXL-</option>
                </select><br></td>
            </tr>
            <!-- <tr>
              <td>需要作废的件数： </td>
              <td align="left">
<input type="text" name="invalidNum" id="invalidNum"></td>
            </tr>-->
          </table>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" 
               data-dismiss="modal"> 关闭 </button>
            <button type="button" class="btn btn-primary"  onclick="atsmakeinvalid()"> 提交 </button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
  <!-- /.modal -->
  </form>
  
  <!--优先处理的订单标识-->
  <form  method="post">
  <div class="modal fade" id="urgentorder" tabindex="-1" role="dialog" aria-labelledby="surgentorder" aria-hidden="true">
    <div class="modal-dialog" style="width:740px;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" 
               aria-hidden="true">× </button>
          <h4 class="modal-title" id="surgentorder"> 优先处理订单  </h4>
        </div>
        <div class="modal-body">
         <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="100">优先处理理由 </td>
              <td align="left">
              
           <!--<select name="urgentordermemo" id="urgentordermemo" class="selection " style="width:100px;" >
          <option value="" >请选择</option>
        <option value="赶节日前送达" {{if $status=='赶节日前送达'}} selected{{/if}}>赶节日前送达</option>
        <option value="订单已经一个月以上了" {{if $status=='订单已经一个月以上了'}} selected{{/if}}>订单已经一个月以上了</option>
       
      </select>   -->     
      
      <textarea name="urgentordermemo" id="urgentordermemo" cols="10" rows="10"></textarea>
              
            </tr>
            
            <tr>
              <td width="100" colspan="2">请填写优先处理理由，以待审核人员审核！<font color="red"><B>并且只有派过单的才能申请</B></font></td>
            </tr>
          <tbody id="showmabangid"></tbody>
          </table>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" 
               data-dismiss="modal"> 关闭 </button>
            <button type="button" class="btn btn-primary"  onclick="saveurgentorder()"> 提交 </button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
  <!-- /.modal -->
  </form>
  <!--结束-->
  
   <!-- 模态框（Modal）手动派单 -->
  <form  method="post">
  <div class="modal fade" id="exportorder" tabindex="-1" role="dialog" aria-labelledby="sexportorder" aria-hidden="true">
    <div class="modal-dialog" style="width:740px;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" 
               aria-hidden="true">× </button>
          <h4 class="modal-title" id="sshowmabangorder"> 输入订单编号  </h4>
        </div>
        <div class="modal-body">
         <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="100">马帮订单号（非交易单号）： </td>
              <td align="left"><textarea name="getmborderlist" id="getmborderlist" cols="10" rows="10"></textarea>多个","隔开</td>
            </tr>
            
             <tr>
              <td width="100">订单来源 </td>
              <td align="left">
              <select name="cf" id="cf">
              <option value="0">请选择</option>
              <option value="1">订单来源于马帮</option>
              <option value="2">订单来自新系统</option></select></td>
            </tr>
            
            <tr>
              <td width="100" colspan="2">手动导单条件：马帮订单状态已支付，配货中，新订单，商品编号为定制的SKU<br>手动导单不判断已派单成功的订单。重复派单会派出多个工厂订单！派出多个请作废</td>
            </tr>
          <tbody id="showmabangid"></tbody>
          </table>
          <div class="modal-footer">
            <button type="button" class="btn btn-default" 
               data-dismiss="modal"> 关闭 </button>
            <button type="button" class="btn btn-primary"  onclick="atsavemangban()"> 提交 </button>
          </div>
        </div>
        <!-- /.modal-content --> 
      </div>
      <!-- /.modal-dialog --> 
    </div>
  </div>
  <!-- /.modal -->
  </form>
 <script type="text/javascript">
	 function produce_status(flag,status)
	 {
		 var str = selectallpro();
		 if(str !=false)
		 {
			 if(flag==1){ //显示
				 $("#producestatus").val(0);
				 $("#pcaijian").val(0);
				 $("#pworkers").val(0);
				 $("#workersid").hide();
				 $("#caijianid").hide();
				 $('#producestatusorderform').modal('show');
			 }
			 if(flag==2){ //显示裁剪或车工
				 var producestatus = $("#producestatus").val();

				 if(producestatus == 1 || producestatus==2){
					 $("#workersid").hide();
					 $("#caijianid").show();
				 }
				 if(producestatus == 3 || producestatus==4){
					 $("#caijianid").hide();
					 $("#workersid").show();
				 }

			 }
			 if(flag==3){ //提交
				 var producestatus = $("#producestatus").val();
				 if(producestatus == 0){
					 alert("状态必须选择");return false;
				 }
				 if(producestatus == 1 || producestatus==2){
					 var caijian = $("#pcaijian").val();
					 if(caijian == 0){
						 alert("裁剪人员必须选择");return false;
					 }
				 }
				 if(producestatus == 3 || producestatus==4){
					 var caijian = $("#pworkers").val();
					 if(caijian == 0){
						 alert("生产工人必须选择");return false;
					 }
				 }
				 var cur_date = $("#cur_date").val();
				 $.post("/factory/ajaxbutton", {"op": "producestatusorder","id":str,"producestatus":producestatus,"caijian":caijian,"cur_date":cur_date},
						 function(data){
							 if(data==200)
							 {
								alert("操作成功");
								 location.reload();
							 }else{
								 alert("操作失败");return false;
							 }


						 },"text");
			 }
		 }



	 }
 </script>
</body>
</html>